

import threading
import os


class ThreadTrackId():
    thread_trackId = dict()

    @classmethod
    def get_trackId(cls, pid_tid):
        return cls.thread_trackId.get(pid_tid, 'trackId')

    @classmethod
    def update_trackId(cls, pid_tid, trackId):
        cls.thread_trackId[pid_tid] = trackId

    @classmethod
    def get_pid_tid(cls):
        # pid = os.getpid()
        tid = threading.currentThread().ident
        return str(tid)

    @classmethod
    def get_trackId_op(cls):
        # pid = os.getpid()
        tid = threading.currentThread().ident
        pid_tid = str(tid)
        return cls.thread_trackId.get(pid_tid, 'trackId')